<template>
	<view class="hx-store" @touchstart="touchStart">
		<hx-navbar :fixed="true"  barPlaceholder="hidden" transparent="auto"
			 :rightSlot="false"  :pageScroll.sync="pageScroll" height="140rpx">
			<!-- <block slot="left">
				<view class="" style="margin-left: 12rpx; font-size: 40rpx;" @click="navBack"><u-icon name="arrow-left" color="#000" ></u-icon>
				</view>
			</block> -->
		</hx-navbar>
		<!-- <hx-navbar  :border="false" :centerSlidiSwitch="true" :rightSlidiSwitch="false" :fixed="true"
			 :pageScroll.sync="scrollData" transparent="hidden">
			
		</hx-navbar> -->
		<!-- 只需要绑定购物车位置即可 -->
		<flyInCart ref="inCart" :cartBasketRect="cartBasketRect"></flyInCart>
		<!-- 头部 -->
		<view class="header" >
			<view class="header-bg"  ></view>
			<!-- <view :class="showStoreBox ? 'header-bg-gray' : 'header-bg-black'" style="background-color: #000000;"></view> -->
			<view class="header-top-Placeholder" ></view>
			<view class="container storeInfo hx-shadow" :style="{ height: storeInfoBoxHeight + 'px' }">
				<image class="storeAvatar hx-shadow" :src="storeData.data.avatar" mode="aspectFill"></image>
				<view style="display: flex;align-items: center;">
					<text class="tit margin-right-sm" style="margin-left: 2rpx;font-size: 38rpx;font-weight: bold;">{{ storeData.data.name }}</text>
				</view>
				<view class="hintMessage">
					<view v-if="storeData.data.delivery == 3" class="item" >免上楼费</view>
					<view v-if="storeData.data.isNew" class="item">新客立减{{storeData.data.newMoney}}元</view>
				<view class="hx-txt-14 hx-color-black item" >{{ storeData.data.info }}</view>
				</view>
			</view>
		</view>

		<!-- 主体 -->
		<view class="main" :style="{ height: mainHeight }">
			<!-- <view class="" :style="{display:showZz}" style="position: absolute;top: 0;bottom: 0;left: 0;width: 100%; background: #3F536E;z-index: 999;opacity: 0.5;">
				遮罩
			</view> -->
			<view class="tabs-box"
				:style="{'background-color': 'rgba(245,245,245,' + navSearchBgOpacity + ')' }">
				<view class="" style="width: 420rpx; height: 100%;">
					<view class="hx-tabs">
						<view class="hx-tabs-item" v-for="(item, i) in tabs" :key="i"
							:class="{ 'hx-tabs-active': swiperCurrent == i }" @click="swiperChange(i)"
							:style="{ transition: transtionTime + 'ms' }">
							<text>{{ item.name }}</text>
						</view>
						<view class="hx-tabs-slider-box"
							:style="{ transition: transtionTime + 'ms', left: swiperCurrentSliderLeft + 'px' }">
							<view class="hx-tabs-slider"></view>
						</view>
					</view>
				</view>
			</view>
			
			<swiper id="mainSwiper" style="height: 100%;" :current="swiperCurrent" :duration="transtionTime">
				<!-- 购物 -->
				<swiper-item class="swiper-item">
					<view class="scroll-items">
						<view class="category-list">
							<!-- 左侧分类导航 -->
							<scroll-view :scroll-top="menuScrollTop" :scroll-y="goodsBoxScroll" class="left">
								<view v-for="item in categoryList" :key="item.id" class="row"
									:class="{ active: item.id == menuCurrentId }" @click="showCategory(item)">
									<view class="text">{{ item.name }}</view>
									<view class="row-number" v-if="item.number">{{ item.number }}</view>
								</view>
							</scroll-view>
							<!-- 右侧子导航 -->
							<scroll-view scroll-with-animation :scroll-y="goodsBoxScroll" class="right"
								:scroll-into-view="tabScrollTop">
								<view class="goodsListBox">
									<view class="category" v-for="item in categoryList" :key="item.id"
										:id="'goodsBox' + item.id">
										<view class="s-item">{{ item.name }}</view>
										<view class="list">
											<view class="box" v-for="(rowData, i) in goodsList"
												v-if="item.id == rowData.type_id" :key="i">
												<!-- 商品列表 -->
												<!-- <m-store-pro @touchOnGoods="touchOnGoods" :rowData="box"></m-store-pro>
													 -->
												<!-- 商品列表 -->
												<view class="m-store-item" v-if="rowData.state!=0">
													<view class="m-img" @click="todetail(i)">
														<image style="width: 100%;height: 100%;" :src="rowData.img"
															mode="aspectFill"></image>
													</view>
													<view class="m-text">
														<view class="m-title" @click="todetail(i)">{{ rowData.name }}</view>
														<view class="m-descripe" @click="todetail(i)">
															<!-- {{rowData.descripe}} -->
														</view>
														<block v-if="rowData.form_child.length"  @click="todetail(i)">
															<view class="m-price-box">
																<view class="symbol">￥</view>
																<view class="m-price">{{ rowData.price }}
																</view>
																<view class="m-old-price"
																	v-if="rowData.oldprice">
																	<text>￥{{ rowData.oldprice }}</text>
																</view>
															</view>
														</block>
														<block v-else @click="todetail(i)">
															<view class="m-price-box">
																<view class="symbol">￥</view>
																<view class="m-price">{{ rowData.price }}</view>
																<view class="m-old-price" v-if="rowData.oldprice">
																	<text>￥{{ rowData.oldprice }}</text>
																</view>
															</view>
														</block>
														<view class="m-distance">
															<block v-if="rowData.form_child.length">
																<view class="miniBtn "   @click="showForm(rowData)"  >
																	<text>选规格</text>
																	<!-- #ifdef APP-PLUS || H5 -->
																	<view class="num" v-if="getCartGoodsNum(rowData)">
																		{{ getCartGoodsNum(rowData) }}</view>
																	<!-- #endif -->
																</view>
															</block>
															<block v-else>
																<view :class="'addEle_' + i" class="jumpPosition">
																</view>
																<hx-number-box @change="addGoodsChange"
																	:value="rowData.number" :rowData="rowData"
																	@addChange="touchOnAddGoods('.addEle_' + i, rowData)">
																</hx-number-box>
															</block>
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
							</scroll-view>
						</view>
					</view>
				</swiper-item>

				<!-- 商家 -->
				<swiper-item class="swiper-item">
					<view class="scroll-items business-box">
						<view class="info-list hx-mt-15">
							<view class="info-list-container">
								<i class="hxicon-location"></i>
								<text>{{ storeData.data.address }}</text>
							</view>
						</view>
						<view class="info-list hx-mt-15 ">
							<view class="info-list-container hx-bb">
								<i class="hxicon-time"></i>
								<text>配送时间：{{ storeData.data.delivery_time }}</text>
							</view>
						</view>
						<view class=" info-list">
							<view class="info-list-container" @click="goCall(storeData.data.telephone)">
								<i class="hxicon-phone"></i>
								<text style="flex: 1;">商家电话：{{ storeData.data.telephone }}</text>
								<view class="right">
									<text>拨打</text>
									<i class="hxicon-right"></i>
								</view>
							</view>
						</view>
						<view class="info-list hx-mt-15">
							<view class="info-list-container" @click="showStoreBoxFunc">
								<i class="hxicon-new" style="color:#ff3333"></i>
								<text style="flex: 1;">商家当前热门活动</text>
								<view class="right">
									<text>查看</text>
									<i class="hxicon-right"></i>
								</view>
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>

		<!-- 购物车 -->
		<view class="foot" @touchmove.stop.prevent="mpClear" :style="{ height: footHeight }" v-if="showFoot">
			<view class="zz" @click="hideShoppingCar"></view>
			<view class="btn-box">
				<!-- <view class="btn-box-left" @click="contact">
					<view class="imgBox">
						<image src="../../static/store/contact.png" mode=""></image>
					</view>
					<text>联系商家</text>
				</view> -->
				<!-- <view class="btn-box-line"></view> -->
				<view class="btn-box-center" @click="showShoppingCar">
					<view class="cart" :animation="cartAnimationData">
						<view class="tag cartNum" v-if="goodsTotalNumber > 0">{{ goodsTotalNumber }}</view>
						<image :src="goodsTotalNumber ? '/static/store/index.png' : '/static/store/unselected.png'" mode="">
						</image>
					</view>
					<view class="priceBox">
						<view class="hx-txt-18 hx-color-white" v-if="goodsTotalPrice > 0"><text style="font-size: 20rpx;">￥</text>{{ goodsTotalPrice }}</view>
						<view class="hx-txt-10 hx-color-gray">另需配送费￥{{ shippingDees }}</view>
					</view>
				</view>
				<view class="btn-box-right" >
					<view class="jiesuan" v-if="goodsTotalPrice > 0 && goodsTotalPrice >= startingPrice"
						@click="jiesuan">立即下单</view>
					<view class="pscj hx-txt-10 hx-color-gray" v-else>
						<text v-if="startingPrice > 0">差￥{{getMoney(goodsTotalPrice)}}起送</text>
					</view>
				</view>
			</view>

			<!-- 购物车商品列表 -->
			<view class="cart-box" :style="{ display: showCar ? 'flex' : 'none' }">
				<view class="box-container rebate-box" v-if="showDiscount"><text>购物车</text></view>
				<view class="box-container operating-box">
					<view class="operating-box_right"></view>
					<view class="operating-box_left clear" @click="clearShoppingCart">
						<i class="hxicon-delete"></i>
						<text>清空购物车</text>
					</view>
				</view>
				<view class="goods-box" v-if="showCar">
					<view class="" style="flex: 1;">
						<scroll-view scroll-y="true" class="goods-list-scroll" :scroll-top="carGoodsScrollTop">
							<view class="goods-list">
								<view class="box" v-for="(rowData, i) in shoppCart" :key="rowData.id"
									v-if="rowData.number > 0">
									<view class="m-store-item">
										<view class="m-img">
											<image style="width: 100%;height: 100%;" :src="rowData.img"
												mode="aspectFit"></image>
										</view>
										<view class="m-text">
											<view class="m-title">{{ rowData.name }}</view>
											<view class="m-descripe">
												{{ rowData.current_form ? rowData.current_form.name : rowData.descripe }}
											</view>
											<view class="m-price-box">
												<view class="symbol">￥</view>
												<view class="m-price">{{ rowData.price }}</view>
												<view class="m-old-price" v-if="rowData.oldprice">
													<text>￥{{ rowData.oldprice }}</text>
												</view>
											</view>
											<view class="m-distance">
												<view :class="'addEle2_' + rowData.id" class="jumpPosition"></view>
												<hx-number-box @change="addGoodsChange" :value="rowData.number"
													:rowData="rowData" :clickTime="animaTime"
													@addChange="touchOnAddGoods('.addEle2_' + rowData.id, rowData)">
												</hx-number-box>
											</view>
										</view>
									</view>
								</view>
							</view>
						</scroll-view>
					</view>
				</view>
			</view>
		</view>
		<!-- v-if="showFormBox" -->

		<!-- 多规格 -->
		<uni-popup ref="popup" type="center" @change="popupChange">
			<view class="form-main" v-if="currentGoodsData.name">
				<view class="form-main_ctn" @click.stop.prevent="mpClear">
					<scroll-view class="" style="display: flex;width: 100%; height: 80%;" scroll-y="true">
						<view class="godos_tit">
							<text>{{ currentGoodsData.name }}</text>
						</view>
						<!-- //规格排列 -->
						<view class="gg_tit" v-for="(formItem, index) in currentGoodsData.form" :key="index">
							<text>{{ formItem.name }}</text>
							<view class="gg_box">
								<block v-for="form_child in currentGoodsData.form_child" :key="form_child.id"
									v-if="form_child.pid == formItem.id">
									<view class="item" :class="{ active: form_child.select }"
										@click="selectGoodsForm(currentGoodsData, formItem, form_child)">
										{{ form_child.name }}
									</view>
								</block>
							</view>
						</view>
					</scroll-view>
					<!-- 已选规格 -->
					<view class="select_gg">
						<text class="lable">已选规格：</text>
						<view class="select_gg_box">
							<block v-for="form_child in currentGoodsData.form_child" :key="form_child.id"
								v-if="form_child.select == true">
								<view class="gg-item">
									<text>{{ form_child.name }}</text>
									<text class="gg-item-cut">,</text>
								</view>
							</block>
						</view>
					</view>
					<!-- 加入购物车及数量设置 -->
					<view class="bottom">
						<view class="price_box">
							<text>￥</text>
							<text class="price">{{ currentGoodsData.totalpricetemp }}</text>
						</view>
						<view class="form-btn-box">
							<block v-if="!currentGoodsData.number">
								<view id="ggAddBtn" class="add-btn" @click="formFirstAddGoods()">
									<i class="hxicon-add" id="eleAdd"></i>
									<text>加入购物车</text>
								</view>
							</block>
							<block v-else>
								<view class="addEle_gg jumpPosition"></view>
								<hx-number-box @change="formAddGoodsChange" :value="currentGoodsData.number"
									:rowData="currentGoodsData" :clickTime="animaTime + 200"
									@addChange="touchOnAddGoods('.addEle_gg', currentGoodsData)"></hx-number-box>
							</block>
						</view>
					</view>
				</view>
				<view class="close" @click="hiddenForm()"><i class="hxicon-close"></i></view>
			</view>
		</uni-popup>
	
	
	</view>
</template>

<script>
	//数据库引入
	const db = uniCloud.database();
	const dbCmd = db.command;
	//引入全局变量
	var app = getApp();

	//引入资源
	
	// #ifdef H5
	var jweixin = require('../../node_modules/jweixin-module');
	// #endif
	
	//引入组件
	import uniIcons from '@/components/uni-icons/uni-icons.vue';
	import hxNavbar from '@/components/hx-navbar/hx-navbar.vue';
	import jumpBall from '@/components/hx-jump-ball/hx-jump-ball.vue';
	import hxNumberBox from '@/components/uni-number-box/uni-number-box.vue';
	import hxComment from '@/components/hx-comment/hx-comment.vue';
	//  加入购物车动画组件
	import flyInCart from '@/components/flyInCart.vue';
	//引入测试数据
	var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;

	export default {
		components: {
			jumpBall,
			hxNavbar,
			uniIcons,
			hxNumberBox,
			hxComment,
			flyInCart
		},
		data() {
			return {
				userinfo: {},
				id: 0,
				pageScroll: {},
				//商家信息
				storeData: [],
				//商品列表
				goodsList: [],
				//商品分类信息列表
				categoryList: [],
				//评论列表
				commentList: [],
				navSearchWidth: 3,
				navSearchBgOpacity: 0,
				navSearchColor: '#ffffff',
				navHeadHeight: 44,
				//默认禁止商品栏滚动
				goodsBoxScroll: true,
				statusBarHeight: 0,
				//动画时间
				animaTime: 300,
				//商家盒子高度
				storeInfoBoxHeight: 100,
				//展开门店信息容器
				showStoreBox: false,
				num: 1,
				element: [],
				cartAnimation: {},
				cartAnimationData: {},
				//tabs
				tabs: [{
						name: '商品'
					},
					{
						name: '商家'
					}
				],
				swiperCurrent: 0,
				dx: 0,
				swiperCurrentSliderLeft: 0,
				transtionTime: 100,
				//所有购物车
				shoppingCartAll: [],
				//显示购物车
				showFoot: true,
				//配送费
				shippingDees: 0,
				//配送起步价
				startingPrice: 0,
				//购物车商品价格合计
				goodsTotalPrice: 0,
				//购物车商品数量合计
				goodsTotalNumber: 0,
				//当前门店购物车
				shoppCart: [],
				//foot 高度
				footHeight: '0',
				//显示购物车
				showCar: false,
				//购物车中商品滚动条位置
				carGoodsScrollTop: 0,
				//购物车缓存 Storage 名称
				shoppingCartStorageName: 'shopping_cart',
				sizeCalcState: false,
				tabScrollTop: 'goodsBox6',
				mainHeight: 0,
				menuCurrentId: 1,
				//购物车显示折扣
				showDiscount: true,
				//手指触摸滑动
				touchData: {},
				//页面滚动条距离顶部的距离
				pageScrollTop: 0,
				menuScrollTop: 0,
				//多规格当前产品
				currentGoodsData: {},
				//显示规格容器
				showFormBox: false,
				//显示规格动画
				formAnimationData: {},
				ispass: '', //商家是否需要打印小票
				//购物车位置数据
				cartBasketRect: {},
				navStatus: true,
				isBack: true,
				isstart:false,
				schoolIndex:0,
				tejiaID:999
			};
		},
		onShow() {
			let that = this;
			uni.showLoading({
				title: '加载中'
			});
			if(that.sign==1||that.sign==5){
				db.collection('storeList')
					.where({
						'data.store_id': that.id
					})
					.get({
						getOne: true
					})
					.then(res => {
						console.log('商家店铺列表', res);
						//本商店缓存名【以id标识】
						that.shoppingCartStorageName = 'shopping_cart' + that.id;
						//加载商品数据
						that.storeData = res.result.data;
						that.startingPrice = that.storeData.data.starting_price
						that.ispass = that.storeData.data.ispass;
						that.isstart = that.storeData.data.isstart;
						console.log("isstart",that.isstart)
						
						if(!that.isstart){
							uni.showModal({
								title:"该店铺已暂停营业，请选择其他店铺~",
								success(res) {
									uni.switchTab({
										url:"../index/index"
									})
									return
								}
							})
						}
						
						console.log('place', that.ispass);
						//请求商品详情
						db.collection('goodDetail')
							.where({
								'data.parentid': that.id
							})
							.get({})
							.then(e => {
								console.log('商家详情', e);
								that.packnum = e.result.data[0].data.packnum;
								that.sn = e.result.data[0].data.sn;
								//商品列表
								that.goodsList = e.result.data[0].data.goodsList;
								//商品分类信息列表
								that.categoryList = e.result.data[0].data.categoryList;
								//TOOD:J进行价格修改的逻辑代码修改
								//第0步先问后端能不能加
								uni.request({
									url:"https://zback.shixiaozhu.work/ShixiaozhuTest/store/checkStore?storeId="+that.id,
									success(res) {
										if(res.data.status == 200){
											
											//第一步先找出来特价的id
											for (var i = 0; i < that.categoryList.length; i++) {
												if(that.categoryList[i].name.indexOf("特价") != -1){
													that.tejiaID = that.categoryList[i].id
												}
											}
											//第二步判断他两下，一下他是不是特价产品，一下他是不是小于12的产品，如果都不是，就加一块
											for (var i = 0; i < that.goodsList.length; i++) {
												if(that.goodsList[i].type_id != that.tejiaID){
													//说明不是特价
													if(Number(that.goodsList[i].price)<=12){
														//说明是零食，那就不加价
														that.goodsList[i].isjia = false
													}else{
														//说明可以加价，直接标识，如果是多规格，那就给有价格的规格加1
														//先看是不是多规格
														that.goodsList[i].isjia = true
														if(that.goodsList[i].form_child==0){
															//没有规格
															console.log(that.goodsList[i].name+"加价了")
															that.goodsList[i].price = Number(Number(that.goodsList[i].price)+0.3).toFixed(2)
														}else{
															//有规格
															that.goodsList[i].price = Number(Number(that.goodsList[i].price)+0.3).toFixed(2)
															for (var j = 0; j < that.goodsList[i].form_child.length; j++) {
																if(Number(that.goodsList[i].form_child[j].price)>0){
																	that.goodsList[i].form_child[j].price = Number(Number(that.goodsList[i].form_child[j].price)+0.3).toFixed(2)
																}else{
																}
															}
														}
													}
												}else{
													that.goodsList[i].isjia = false
												}
											}
											//价格修改完成
										}else{
											for (var i = 0; i < that.goodsList.length; i++) {
												that.goodsList[i].isjia = false
											}
										}
									}
								})
								
								//评论列表
								that.commentList = e.result.data[0].data.commentList;
								//屏幕高度 - 头部导航高度 - 状态栏高度 - 分页高度
								let sysInfo = uni.getSystemInfoSync();
								that.mainHeight = sysInfo.screenHeight - 43 - statusBarHeight - 40 + 'px';
								let q = uni.createSelectorQuery();
								setTimeout(function() {
									that.calcSize();
									console.log('开始执行');
									q.select('.cart')
										.boundingClientRect(data => {
											that.cartBasketRect = data;
										})
										.exec();
								}, 100);
								that.init();
								uni.hideLoading();
							})
							.catch(err => {});
					})
					.catch(err => {});
			}else if(that.sign==2){
				db.collection('nightStore')
					.where({
						'data.store_id': that.id
					})
					.get({
						getOne: true
					})
					.then(res => {
						console.log('商家店铺列表', res);
						//本商店缓存名【以id标识】
						that.shoppingCartStorageName = 'shopping_cart' + that.id;
						//加载商品数据
						that.storeData = res.result.data;
						that.startingPrice = that.storeData.data.starting_price
						that.ispass = that.storeData.data.ispass;
						that.isstart = that.storeData.data.isstart;
						console.log("isstart",that.isstart)
						
						// 时 getHours()：(0 ~ 23)
						var date = new Date();
						var hour = date.getHours();
						var cont = date.getMinutes();
						if(hour==21&&cont>40){
							console.log("时间点已关闭")
							//将全部关闭早餐时间点
							db.collection('nighttime').update({
								data:{
									iskai:false
								}
							})
							uni.showModal({
								title:"夜宵时间点已关闭",
								success(res) {
									uni.switchTab({
										url:"../index/index"
									})
									return
								}
							})
						}else{
							console.log("当前小时",hour)
							//、可以点单
							// db.collection('morningtime').update({
							// 	data:{
							// 		iskai:true
							// 	}
							// })
						}
						
						
						if(!that.isstart){
							uni.showModal({
								title:"该店铺已暂停营业，请选择其他店铺~",
								success(res) {
									uni.switchTab({
										url:"../index/index"
									})
									return
								}
							})
						}
						
						console.log('place', that.ispass);
						//请求商品详情
						db.collection('goodDetail')
							.where({
								'data.parentid': that.id
							})
							.get({})
							.then(e => {
								console.log('商家详情', e);
								that.packnum = e.result.data[0].data.packnum;
								that.sn = e.result.data[0].data.sn;
								//商品列表
								that.goodsList = e.result.data[0].data.goodsList;
								//商品分类信息列表
								that.categoryList = e.result.data[0].data.categoryList;
								
								//TOOD:J进行价格修改的逻辑代码修改
								//第0步先问后端他是不是买过这家店的东西
								//第一步先找出来特价的id
								uni.request({
									url:"https://zback.shixiaozhu.work/ShixiaozhuTest/store/checkStore?storeId="+that.id,
									success(res) {
										if(res.data.status == 200){
											
											//第一步先找出来特价的id
											for (var i = 0; i < that.categoryList.length; i++) {
												if(that.categoryList[i].name.indexOf("特价") != -1){
													that.tejiaID = that.categoryList[i].id
												}
											}
											//第二步判断他两下，一下他是不是特价产品，一下他是不是小于12的产品，如果都不是，就加一块
											for (var i = 0; i < that.goodsList.length; i++) {
												if(that.goodsList[i].type_id != that.tejiaID){
													//说明不是特价
													if(Number(that.goodsList[i].price)<=12){
														//说明是零食，那就不加价
														that.goodsList[i].isjia = false
													}else{
														//说明可以加价，直接标识，如果是多规格，那就给有价格的规格加1
														//先看是不是多规格
														that.goodsList[i].isjia = true
														if(that.goodsList[i].form_child==0){
															//没有规格
															console.log(that.goodsList[i].name+"加价了")
															that.goodsList[i].price = Number(Number(that.goodsList[i].price)+0.3).toFixed(2)
														}else{
															//有规格
															that.goodsList[i].price = Number(Number(that.goodsList[i].price)+0.3).toFixed(2)
															for (var j = 0; j < that.goodsList[i].form_child.length; j++) {
																if(Number(that.goodsList[i].form_child[j].price)>0){
																	that.goodsList[i].form_child[j].price = Number(Number(that.goodsList[i].form_child[j].price)+0.3).toFixed(2)
																}else{
																}
															}
														}
													}
												}else{
													that.goodsList[i].isjia = false
												}
											}
											//价格修改完成
										}else{
											for (var i = 0; i < that.goodsList.length; i++) {
												that.goodsList[i].isjia = false
											}
										}
									}
								})
								//价格修改完成
								
								//评论列表
								that.commentList = e.result.data[0].data.commentList;
								//屏幕高度 - 头部导航高度 - 状态栏高度 - 分页高度
								let sysInfo = uni.getSystemInfoSync();
								that.mainHeight = sysInfo.screenHeight - 43 - statusBarHeight - 40 + 'px';
								let q = uni.createSelectorQuery();
								setTimeout(function() {
									that.calcSize();
									console.log('开始执行');
									q.select('.cart')
										.boundingClientRect(data => {
											that.cartBasketRect = data;
										})
										.exec();
								}, 100);
								that.init();
								uni.hideLoading();
							})
							.catch(err => {});
					})
					.catch(err => {});
			}else if(that.sign==3){
				db.collection('morningStore')
						.where({
							'data.store_id': that.id
						})
						.get({
							getOne: true
						})
						.then(res => {
							console.log('商家店铺列表', res);
							//本商店缓存名【以id标识】
							that.shoppingCartStorageName = 'shopping_cart' + that.id;
							//加载商品数据
							that.storeData = res.result.data;
							that.startingPrice = that.storeData.data.starting_price
							that.ispass = that.storeData.data.ispass;
							that.isstart = that.storeData.data.isstart;
							console.log("isstart",that.isstart)
							// 时 getHours()：(0 ~ 23)
							var date = new Date();
							var hour = date.getHours();
							if(hour>=2&&hour<14){
								console.log("时间点已关闭")
								//将全部关闭早餐时间点
								db.collection('morningtime').update({
									data:{
										iskai:false
									}
								})
								uni.showModal({
									title:"早餐时间点已关闭",
									success(res) {
										uni.switchTab({
											url:"../index/index"
										})
										return
									}
								})
							}else{
								//先判断是周几，周五周六是开放第二个时间点，其余都是第一个时间点
								if(that.week()=='星期五'||that.week()=='星期六'){
									db.collection('morningtime').doc('627e4cad2319ec0001a3c322').update({
										data:{
											"iskai":true
										}
									})
								}else{
									db.collection('morningtime').doc('633878c9d2b9120001de2552').update({
										data:{
											"iskai":true
										}
									})
								}
								
							}
							
							if(!that.isstart){
								uni.showModal({
									title:"该店铺已暂停营业，请选择其他店铺~",
									success(res) {
										uni.switchTab({
											url:"../index/index"
										})
										return
									}
								})
							}
							
							console.log('place', that.ispass);
							//请求商品详情
							db.collection('goodDetail')
								.where({
									'data.parentid': that.id
								})
								.get({})
								.then(e => {
									console.log('商家详情', e);
									that.packnum = e.result.data[0].data.packnum;
									that.sn = e.result.data[0].data.sn;
									//商品列表
									that.goodsList = e.result.data[0].data.goodsList;
									//商品分类信息列表
									that.categoryList = e.result.data[0].data.categoryList;
									//评论列表
									that.commentList = e.result.data[0].data.commentList;
									//屏幕高度 - 头部导航高度 - 状态栏高度 - 分页高度
									let sysInfo = uni.getSystemInfoSync();
									that.mainHeight = sysInfo.screenHeight - 43 - statusBarHeight - 40 + 'px';
									let q = uni.createSelectorQuery();
									setTimeout(function() {
										that.calcSize();
										console.log('开始执行');
										q.select('.cart')
											.boundingClientRect(data => {
												that.cartBasketRect = data;
											})
											.exec();
									}, 100);
									that.init();
									uni.hideLoading();
								})
								.catch(err => {});
						})
						.catch(err => {});
			}else{
				db.collection('deliveryStore')
					.where({
						'data.store_id': that.id
					})
					.get({
						getOne: true
					})
					.then(res => {
						console.log('商家店铺列表', res);
						//本商店缓存名【以id标识】
						that.shoppingCartStorageName = 'shopping_cart' + that.id;
						//加载商品数据
						that.storeData = res.result.data;
						that.startingPrice = that.storeData.data.starting_price
						that.ispass = that.storeData.data.ispass;
						that.isstart = that.storeData.data.isstart;
						console.log("isstart",that.isstart)
						
						if(!that.isstart){
							uni.showModal({
								title:"该店铺已暂停营业，请选择其他店铺~",
								success(res) {
									uni.switchTab({
										url:"../index/index"
									})
									return
								}
							})
						}
						console.log('place', that.ispass);
						//请求商品详情
						db.collection('goodDetail')
							.where({
								'data.parentid': that.id
							})
							.get({})
							.then(e => {
								console.log('商家详情', e);
								that.packnum = e.result.data[0].data.packnum;
								that.sn = e.result.data[0].data.sn;
								//商品列表
								that.goodsList =that.sortByPaixu(e.result.data[0].data.goodsList,'paixu') ;
								//商品分类信息列表
								that.categoryList = e.result.data[0].data.categoryList;
								//评论列表
								that.commentList = e.result.data[0].data.commentList;
								//屏幕高度 - 头部导航高度 - 状态栏高度 - 分页高度
								let sysInfo = uni.getSystemInfoSync();
								that.mainHeight = sysInfo.screenHeight - 43 - statusBarHeight - 40 + 'px';
								let q = uni.createSelectorQuery();
								setTimeout(function() {
									that.calcSize();
									console.log('开始执行');
									q.select('.cart')
										.boundingClientRect(data => {
											that.cartBasketRect = data;
										})
										.exec();
								}, 100);
								that.init();
								uni.hideLoading();
							})
							.catch(err => {});
					})
					.catch(err => {});
			}
			// this.init();
			// 判断登陆!!!
			// TODO:
			this.openid="oryqr6fcWZdnLWZ6OYa1NzymSza0"
			// this.chechLogin();
		},
		onLoad(option) {
			let that = this;
			//加载门店数据
			that.id = option.sid;
			that.sign = option.sign;
			that.schoolIndex = option.school
		},
		onBackPress(event) {
			if (this.showFormBox) {
				this.hiddenForm();
				return true;
			}
			if (!this.isBack) {
				this.$refs.popup.close();
				return true;
			}
		},
		watch: {
			showStoreBox(val, oldVal) {
				if (val == true) {
					this.showStoreBoxFunc();
				} else {
					this.hiddenStoreBoxFunc();
				}
			}
		},
		//页面滚动
		onPageScroll(e) {
			let that = this;
			let top = e.scrollTop;
			that.pageScrollTop = e.scrollTop;
			that.pageScroll = e;
			if (top < 120) {
				if (that.navSearchWidth >= 3) {
					if (top < 3) {
						that.navSearchWidth = 3;
						that.navSearchBgOpacity = 0;
						that.navSearchColor = '#ffffff';
					} else {
						let n = top * (120 / 100);
						if (n > 100) {
							n = 100;
						}
						that.navSearchWidth = n;
						//that.navSearchBgOpacity =1
						that.navSearchBgOpacity = top * (1 / 100);
						that.navSearchColor = '#888888';
					}
				}
			} else {
				that.navSearchWidth = 100;
				that.navSearchBgOpacity = 1;
				that.navSearchColor = '#888888';
			}
			let view = uni.createSelectorQuery().select('.main');
			view.fields({
					rect: true
				},
				data => {
					if (data != null) {
						if (data.top <= statusBarHeight + 44) {
							that.goodsBoxScroll = true;
						} else {
							that.goodsBoxScroll = true;
						}
					}
				}
			).exec();
		},
		//方法
		methods: {
			week(){
				var h=new Date().getDay()-1;
				var we=['星期一','星期二','星期三','星期四','星期五','星期六','星期七']
				return we[h]
			},
			sortByPaixu(array,key){
			return array.sort(function(a,b){
			var x = a[key];
			var y = b[key];
			return((x>y)?-1:((x<y)?1:0));
			})
			},
			//判断登陆
			chechLogin() {
				let that = this;
				uni.getStorage({
					key: 'user_sxz',
					success(res) {
						console.log('获取到store本地数据', res);
						that.userinfo.nickName = res.data.info.nickName;
						that.userinfo.avatarUrl = res.data.info.avatarUrl;
						that.openid = res.data.openid;
						console.log("哈哈",that.openid);
						//判断是否登陆
						if (that.openid == '' || that.openid == undefined) {
							uni.showModal({
								title: '您还没有绑定微信登陆，是否要现在进行绑定？',
								success(res) {
									uni.switchTab({
										url: '../me/me'
									});
									return;
								}
							});
						}
					},
					fail(res) {
						console.log('获取失败', res);
						if(app.globalData.openid!=-1){
							if (app.globalData.openid == undefined || app.globalData.openid == '') {
								uni.showModal({
									title: '您还没有绑定微信登陆，是否要现在进行绑定？',
									success(res) {
										uni.switchTab({
											url: '../me/me'
										});
										return;
									}
								});
							}else{
								that.openid = app.globalData.openid
							}
						}
						else{
							uni.showModal({
								title: '您还没有绑定微信登陆，是否要现在进行绑定？',
								success(res) {
									uni.switchTab({
										url: '../me/me'
									});
									return;
								}
							});
						}
					}
				});
			},
			getMoney(allmoney){
				return parseFloat(this.startingPrice-allmoney).toFixed(2)
			},
			//初始化商品数据
			init() {
				let that = this;
				//后台获取的商品数据
				let goods = this.goodsList;
				//商品初始化
				that.shoppCart = [];
				let carts = uni.getStorageSync(that.shoppingCartStorageName) || [];
				console.log(carts);
				//根据缓存数据 获取购物车中属于本商店的商品
				for (let i in carts) {
					if (carts[i].store_id == that.storeData.store_id) {
						that.shoppCart = carts[i].shopping_cart ? carts[i].shopping_cart : [];
						break;
					}
				}
				console.log("购物车长度", that.shoppCart.length)
				that.goodsTotalPrice = 0;
				that.goodsTotalNumber = 0;
				for (let i in that.shoppCart) {
					for (let j in goods) {
						if (goods[j].id == that.shoppCart[i].id) {
							console.log("执行啦！！！")
							goods[j].number = that.shoppCart[i].number;
						}
					}
					//计算商品总价
					that.goodsTotalPrice += that.shoppCart[i].total;
					//商品总数量
					that.goodsTotalNumber += that.shoppCart[i].number;
				}
				that.goodsTotalPrice = that.numFilter(that.goodsTotalPrice);
				//初始化商品列表
				that.goodsList = goods;
				//初始化起步价和配送费
				that.starting_price = that.storeData.starting_price;
				that.shipping_dees = that.storeData.shipping_dees;
				that.setLabelNumber();
				// if(this.sign==3){
				// 	uni.showModal({
				// 		title:"温馨提示",
				// 		content:"目前早餐配送服务试点楼栋是15,16,20,26,21,24,27,29,31,32九个楼栋哦，其他楼栋的uu们会尽快开启早餐配送服务的哦~",
				// 		success(res) {
				// 			return
				// 		}
				// 	})
				// }
			},
			//选择规格
			selectGoodsForm(currentGoodsData, formItem, formChild) {
				console.log('进入规格选择');
				let childPidIndex = Number(formItem.id); //类别号
				let childIdIndex = Number(formChild.id); //数组号
				let formItemList = []; //目前选择某个规格的数组
				let oldSelectChildId = 0; //初始都为零
				let that = this;
				let n = 0;
				//1、找到原来类别号下的规格数组,并且找到已选择的数组
				for (let i = 0; i < currentGoodsData.form_child.length; i++) {
					if (currentGoodsData.form_child[i].pid == childPidIndex) {
						formItemList.push(currentGoodsData.form_child[i]);
						if (currentGoodsData.form_child[i].select == true) {
							oldSelectChildId = currentGoodsData.form_child[i].id;
						}
					}
				}
				//2、进行状态改变操作
				if (oldSelectChildId == childIdIndex) {
					//判断是否重复点击
					return;
				} else {
					//状态改变操作
					//3、使原来的变为False
					currentGoodsData.form_child[oldSelectChildId].select = false;
					//4、使现在的变为选择项
					currentGoodsData.form_child[childIdIndex].select = true;
					//5、改变购物车状态及目前选择状态调整
					let goodsCart = that.getStoreCart();
					if (goodsCart) {
						for (let i in goodsCart) {
							if (goodsCart[i].id == currentGoodsData.id && goodsCart[i].current_form.id == formChild.id) {
								n = goodsCart[i].number;
								break;
							}
						}
					}
					currentGoodsData.number = n;
					//6、加法计算，实时改变显示的金额
					//6-1、将要操作的规则放入多规格数组
					let selectChildList = []; //多规格数组
					for (let i in currentGoodsData.form_child) {
						if (currentGoodsData.form_child[i].select == true) {

							let item = {
								"id": currentGoodsData.form_child[i].id,
								"pid": currentGoodsData.form_child[i].pid,
								"name": currentGoodsData.form_child[i].name,
								"price": currentGoodsData.form_child[i].price,
								"oldprice": currentGoodsData.form_child[i].oldprice,
								"select": currentGoodsData.form_child[i].select
							}
							
							selectChildList.push(item);
							console.log("第" + i + "次选项：", currentGoodsData.form_child[i].name + currentGoodsData
								.form_child[i].price)
						}
					}
					console.log("此时多规格选中数据：", selectChildList)
					//6-2、将所有信息统一到数组第一条
					let totalMoney = 0;
					for (let i = 0; i < selectChildList.length; i++) {
						totalMoney = totalMoney + Number(selectChildList[i].price);
						console.log("第" + i + "次价格:", selectChildList[i].price)
					}
					console.log("总价格：", totalMoney)
					selectChildList[0].price = totalMoney;
					currentGoodsData.selectChildList = selectChildList[0];
					//赋值总金额
					currentGoodsData.totalpricetemp = totalMoney;
					//7、数据绑定刷新
					this.currentGoodsData = currentGoodsData;
				}
			},
			//加入购物车
			formAddGoodsChange(number, goodsData) {
				let that = this;
				//判断是否为多规格商品
				if (goodsData.form_child == []) {
					if (number >= 1) {
						for (let i in goodsData.form_child) {
							if (goodsData.form_child[i].select == true) {
								that.currentGoodsData.current_form = goodsData.form_child[i];
								console.log('第一次加入购物车输出测试,规格名字：', goodsData.form_child[i].name);
							}
						}
					}
					that.addGoodsChange(number, that.currentGoodsData);
				} else {
					//多规格商品采取价格叠加、规格合并机制，实现最后效果和单规格一样
					var form_child = JSON.parse(JSON.stringify(goodsData.form_child));
					var childListTemp = []; //多规格数组
					var currentGoodsDataTemp = that.currentGoodsData;
					//1、将要操作的规则放入多规格数组
					if (number >= 0) {
						for (let j in form_child) {
							if (form_child[j].select == true) {
								var item = {};
								item = form_child[j];
								childListTemp.push(item);
							}
						}
						console.log('目前选中数组的个数：', childListTemp.length);
					}
					//2、将所有信息统一到数组第一条
					var totalMoney = 0;
					var totaldescrible = '';
					for (let i = 0; i < childListTemp.length; i++) {
						totalMoney = totalMoney + Number(childListTemp[i].price);
						//逗号分割
						if (i == childListTemp.length - 1) {
							totaldescrible = totaldescrible + childListTemp[i].name;
						} else {
							totaldescrible = totaldescrible + childListTemp[i].name + ',';
							console.log('逗号分割：', i);
						}
					}
					console.log('赋值前：', totaldescrible);
					console.log('赋值前name：', childListTemp[0].name);
					//3、赋值核心信息数组【全部规整到第一条】
					childListTemp[0].price = totalMoney.toString();
					childListTemp[0].name = totaldescrible;
					// childListTemp[0].name = '77777';
					console.log('赋值后：', totaldescrible);
					console.log('赋值后name：', childListTemp[0].name);
					console.log('最后显示的：', that.currentGoodsData.form_child[0].name);
					currentGoodsDataTemp.current_form = childListTemp[0];
					//将原来的数据清除

					//购物车计算
					that.addGoodsChange(number, currentGoodsDataTemp);
				}
			},
			//购物车新增删除商品计算价格
			addGoodsChange(number, rowData) {
				console.log('传进来number', number);
				console.log('传进来rowData', rowData);
				let  that = this;
				number = Number(number); //商品数量
				let shoppCart = []; //购物车数组
				let totalPrice = 0; //购物车总价格
				let totalNumber = 0; //购物车总数量

				//是否已有商品
				let existedGoods = false;
				//是否第一次添加商品
				let isFirstAddGoods = true;
				//判断是否为有规格的商品
				let isFormGoods = false;
				if (rowData.current_form) {
					isFormGoods = true;
				}

				let deleteGoods = null;
				let carts = uni.getStorageSync(that.shoppingCartStorageName) || [];
				if (carts.length != 0) {
					isFirstAddGoods = false;
					//根据缓存数据 获取购物车中属于本商店的商品
					for (let i in carts) {
						if (carts[i].store_id == that.storeData.store_id) {
							shoppCart = carts[i].shopping_cart ? carts[i].shopping_cart : [];
							break;
						}
					}

					//1、检查该商品是否为第一次添加，能进入循环则不是第一次添加
					for (var i in shoppCart) {
						console.log("购物车数组的长度：", shoppCart.length)
						// 判断是否为多规格商品
						if (shoppCart[i].id == rowData.id) {
							if (isFormGoods) {
								//相同商品比较规格是否也相同
								if (shoppCart[i].current_form.id == rowData.current_form.id&&shoppCart[i].current_form.name == rowData.current_form.name) {
									existedGoods = true;
								}
							} else {
								existedGoods = true;
							}
							if (existedGoods) {
								//在购物车中移除该商品
								if (number <= 0) {
									//赋值该删除商品到deleteGoods
									console.log("删除商品")
									deleteGoods = shoppCart[i];
									shoppCart[i].number = rowData.number = number
									console.log("要删除具体商品的个数", rowData.number)
									// break;
								}
								//非第一次添加，直接修改商品数量，并计算出单品合计
								if (isFormGoods) {
									shoppCart[i].price = rowData.current_form.price;
									shoppCart[i].oldprice = rowData.current_form.oldprice;
									shoppCart[i].total = number * rowData.current_form.price;
								} else {
									shoppCart[i].price = rowData.price;
									shoppCart[i].oldprice = rowData.oldprice;
									shoppCart[i].total = number * rowData.price;
								}
								shoppCart[i].number = rowData.number = number;
								console.log("显示", rowData.number)
								break;
							}
						}
					}
				}
				//在购物车中移除该商品
				if (deleteGoods != null) {
					console.log('将要从购物车移除的商品：', deleteGoods);
					if (carts) {
						console.log('购物车：', carts.length);
						//根据缓存数据 获取购物车中属于本商店的商品
						for (let i in carts) {
							console.log('购物车存入缓存前：', carts[i].store_id)
							if (carts[i].store_id == that.storeData.store_id) {
								var index = shoppCart.indexOf(deleteGoods);
								if (index > -1) {
									console.log("删除啦！！")
									shoppCart.splice(index, 1);
								}
								carts[i].shopping_cart = shoppCart;
								console.log('购物车存入缓存前：', carts[i].shopping_cart.length)
								uni.setStorage({
									key: that.shoppingCartStorageName,
									data: carts,
									success: function() {
										console.log('success');
										for (let i in that.goodsList) {
											if (that.goodsList[i].id == rowData.id) {
												that.goodsList[i] = rowData;
												break;
											}
										}
										that.init();
									}
								});
								// uni.setStorageSync(that.shoppingCartStorageName, carts);
								break;
							}
						}
					} else {
						// that.storeData.shopping_cart = [];
						// uni.setStorageSync(that.shoppingCartStorageName, []);
					}
					return;
				}
				//第一次添加商品
				if (!existedGoods) {
					if (rowData.form_child.length) {
						rowData.price = rowData.current_form.price;
						rowData.oldprice = rowData.current_form.oldprice;
						rowData.total = number * Number(rowData.current_form.price);
					} else {
						rowData.total = number * Number(rowData.price);
					}
					rowData.number = number;
					shoppCart.push(rowData);
				}
				//计算总商品数量和总价
				for (var i in shoppCart) {
					totalPrice += shoppCart[i].total; //购物车总价格
					totalNumber += shoppCart[i].number; //购物车总数量
				}
				//更改商品列表中的已购买数量
				for (let i in that.goodsList) {
					if (that.goodsList[i].id == rowData.id) {
						that.goodsList[i] = rowData;
						break;
					}
				}

				//最后缓存到本地
				that.goodsTotalPrice = that.numFilter(totalPrice);
				that.goodsTotalNumber = totalNumber;
				that.shoppCart = shoppCart;
				that.storeData.shopping_cart = shoppCart;
				that.setLabelNumber();
				if (isFirstAddGoods) {
					carts.push(that.storeData);
				}
				if (that.goodsTotalNumber == 0) {
					that.hideShoppingCar();
				}
				//购物车商品数据缓存至本地
				uni.setStorageSync(that.shoppingCartStorageName, carts);
			},
			//去结算
			jiesuan() {
				let that =this
				let packnum = 0
				for (var i = 0; i < this.shoppCart.length; i++) {
					packnum = Number(packnum) + Number(parseFloat(this.shoppCart[i].packnum).toFixed(2)) * Number(this
						.shoppCart[i].number)
				}
				//开始计算骑手费了
				let qishou = 1
				for (var i = 0; i < this.shoppCart.length; i++) {
					qishou = Number(qishou) + Number(parseFloat(this.shoppCart[i].qishou).toFixed(2))
				}
				
				//正餐的订单预览
				var newMoney = 0
				if(that.storeData.data.isNew){
					//参加了新客活动
					newMoney = that.storeData.data.newMoney
				}else{
					//店铺没有参加新客活动
					
				}
				
				if(this.sign==4){
					this.navTo("/pages/order/deliveryPreview/deliveryPreview?sid=" + this.storeData.data.store_id + "&openid=" + this.openid +
						"&packnum=" + packnum + "&qishou=" + qishou + "&sn=" + this.sn + "&place=" + this.storeData.data
						.place + "&ispass=" + this.ispass + "&storeImg=" + this.storeData.data.avatar+"&delivery="+this.storeData.data.delivery+"&sign="+this.sign+"&newMoney="+newMoney+"&school="+that.schoolIndex)
				}else if(this.sign==5){
					var typeXu = 0
					for (var l = 0; l < that.shoppCart.length; l++) {
						if(that.shoppCart[l].name.search("电信")!=-1){
							typeXu = 1
							break
						}else if(that.shoppCart[l].name.search("联通")!=-1){
							typeXu = 2
							break
						}else if(that.shoppCart[l].name.search("移动")!=-1){
							typeXu = 3
							break
						}
					}
					console.log("到",typeXu)
					if(typeXu==2){
						var url = 'http://www.73110010.com/weishop/home/index.html?uid=16680806911#';
						window.location.href = url;
					}else{
						this.navTo("/pages/order/xufeiPreview/xufeiPreview?sid=" + this.storeData.data.store_id + "&openid=" + this.openid +
							"&packnum=" + packnum + "&qishou=" + qishou + "&sn=" + this.sn + "&place=" + this.storeData.data
							.place + "&ispass=" + this.ispass + "&storeImg=" + this.storeData.data.avatar+"&delivery="+this.storeData.data.delivery+"&sign="+this.sign+"&typeXu="+typeXu+"&school="+that.schoolIndex)
					}
					
					// this.navTo("/pages/order/xufeiPreview/xufeiPreview?sid=" + this.storeData.data.store_id + "&openid=" + this.openid +
					// 	"&packnum=" + packnum + "&qishou=" + qishou + "&sn=" + this.sn + "&place=" + this.storeData.data
					// 	.place + "&ispass=" + this.ispass + "&storeImg=" + this.storeData.data.avatar+"&delivery="+this.storeData.data.delivery+"&sign="+this.sign)
				}else{
					//正餐的订单预览
					newMoney = 0
					if(that.storeData.data.isNew){
						//参加了新客活动
						newMoney = that.storeData.data.newMoney
					}else{
						//店铺没有参加新客活动
						
					}
					
					
					this.navTo("/pages/order/preview?sid=" + this.storeData.data.store_id + "&openid=" + this.openid +
						"&packnum=" + packnum + "&qishou=" + qishou + "&sn=" + this.sn + "&place=" + this.storeData.data
						.place + "&ispass=" + this.ispass + "&storeImg=" + this.storeData.data.avatar+"&delivery="+this.storeData.data.delivery+"&sign="+this.sign+
						"&school="+that.schoolIndex+"&newMoney="+newMoney)
				}
			},
			
			//获取门店购物车
			getStoreCart() {
				const that = this;
				return that.shoppCart;
			},
			//获取该商品在购物车的数量
			getCartGoodsNum(goods) {
				let cart = this.getStoreCart();
				let n = 0;
				if (cart) {
					for (let i in cart) {
						if (cart[i].id == goods.id) {
							n += cart[i].number;
						}
					}
				}
				return n;
			},
			//分类【商品、商家切换】
			swiperChange(index) {
				this.swiperCurrent = index;
				this.swiperCurrentSliderLeft = 70 * index;
			},
			transition({
				detail: {
					dx
				}
			}) {},
			animationfinish({
				detail: {
					current
				}
			}) {
				this.swiperCurrent = current;
				this.current = current;
				this.swiperChange(current);
				this.showFoot = current == 0 && this.showStoreBox != true ? true : false;
			},
			//一级分类点击【商品分类】
			showCategory(item) {
				const that = this;
				that.isBoxScroll = true;
				that.menuCurrentId = item.id;
				console.log('点击了一级标题', item.id);
				setTimeout(() => {
					let index = that.categoryList.findIndex(sitem => sitem.id === item.id);
					console.log('item', that.categoryList[index].id);
					that.tabScrollTop = 'goodsBox' + that.categoryList[index].id;
					console.log('tabScrollTop', that.tabScrollTop);
				}, 100);
			},
			//右侧栏滚动
			asideScroll(e) {
				const that = this;
				const scrollTop = Math.round(e.detail.scrollTop);
				that.calcSize();
				const tabs = that.categoryList.filter(item => item.top <= scrollTop).reverse();
				if (tabs.length > 0) {
					that.menuCurrentId = tabs[0].id;
				}
				const menuNum = that.categoryList.length;
				const cNum = tabs.length;
				// 定位在第4个分类，当分类滑动到第4格时将不再变换位置。
				const n = 4;
				if (cNum > n) {
					that.menuScrollTop = (cNum - n) * 45;
				} else {
					that.menuScrollTop = 0;
				}
			},
			//计算右侧栏每个tab的高度等信息
			calcSize(event) {
				let h = 0;
				this.categoryList.forEach(item => {
					let view = uni.createSelectorQuery().select('#goodsBox' + item.id);
					view.fields({
							size: true
						},
						data => {
							if (data != null) {
								item.top = h;
								h += Math.round(data.height);
								item.bottom = h;
							}
						}
					).exec();
				});
				this.sizeCalcState = true;
			},
			popupChange(e) {
				this.isBack = !e.show;
			},
			formFirstAddGoods() {
				let that = this;
				that.formAddGoodsChange(1, that.currentGoodsData);
				// that.touchOnAddGoods('#ggAddBtn', that.currentGoodsData);
			},
			//小球跳跃动画
			touchOnAddGoods(ele, data) {
				// const that = this;
				// let q = uni.createSelectorQuery()
				// q.select(ele).boundingClientRect(res => {
				// 	that.$refs.inCart.addToCart(res, data.id);
				// }).exec();
			},
			numFilter(value) {
				// 截取当前数据到小数点后两位
				let realVal = Number(parseFloat(value).toFixed(2));
				return realVal;
			},
			//计算每类商品购买的总数
			setLabelNumber() {
				let that = this;
				//计算每一类购买商品的总数量
				for (let j in that.categoryList) {
					let n = 0;
					for (var i in that.shoppCart) {
						if (that.shoppCart[i].type_id == that.categoryList[j].id) {
							n += that.shoppCart[i].number;
						}
					}
					that.categoryList[j].number = n;
				}
			},
			navTo(url) {
				let that = this;
				if (that.navStatus) {
					that.navStatus = false;
					uni.navigateTo({
						url: url,
						complete: function() {
							that.navStatus = true;
						}
					});
				}
			},
			//跳转到商品详情
			todetail(index){
				let that = this;
				let id = this.id;
				uni.navigateTo({
					url:'good_detail/good_detail'+'?id='+id+"&index="+index
				})
			},
			//联系商家
			contact() {
				uni.makePhoneCall({
					phoneNumber:this.storeData.data.telephone
				})
			},
			showStoreBoxFunc() {
				//TODO:热门活动之后再完善
				// this.storeInfoBoxHeight = uni.getSystemInfoSync().screenHeight - 136;
				// this.$set(this.$data, 'showFoot', false);
				// this.showStoreBox = true;
				// uni.pageScrollTo({
				// 	duration: 0,
				// 	scrollTop: 0
				// })
			},
			hiddenStoreBoxFunc() {
				this.storeInfoBoxHeight = 100;
				this.showStoreBox = false;
				if (this.swiperCurrent == 0) {
					this.$set(this.$data, 'showFoot', true);
				}
			},
			//取消冒泡
			mpClear(e) {
				e.stopPropagation();
			},
			//显示购物车
			showShoppingCar() {
				this.hiddenForm();
				if (this.goodsTotalNumber == 0) {
					return;
				}
				this.footHeight = '100%';
				this.showCar = true;
				this.carGoodsScrollTop = 0;
			},
			//隐藏购物车
			hideShoppingCar() {
				this.footHeight = '0';
				this.showCar = false;
			},
			//清空该门店的购物车
			clearShoppingCart() {
				let that = this;
				that.shoppCart = [];
				that.storeData.shopping_cart = [];
				for (let i in that.shoppingCartAll) {
					if (that.shoppingCartAll[i].store_id == that.storeData.store_id) {
						that.shoppingCartAll[i] = that.storeData;
					}
				}
				uni.setStorageSync(that.shoppingCartStorageName, that.shoppingCartAll);
				for (let i in that.goodsList) {
					that.goodsList[i].number = 0;
				}
				for (let i in that.categoryList) {
					that.categoryList[i].number = 0;
				}
				//购物车商品价格合计
				that.goodsTotalPrice = 0;
				//购物车商品数量合计
				that.goodsTotalNumber = 0;
				that.hideShoppingCar();
			},
			hrefGoodsInfo(id) {
				this.navTo('/pages/product/product?id=' + id);
			},
			//拨打电话
			goCall(phone) {
				if (!phone) {
					return;
				}
				uni.makePhoneCall({
					phoneNumber: phone
				});
			},
			touchStart(e) {
				this.touchData.clientX = e.changedTouches[0].clientX;
				this.touchData.clientY = e.changedTouches[0].clientY;
			},
			//弹出显示规格
			showForm(goods) {
				let that = this;
				let goodsCart = that.getStoreCart();
				if (goodsCart) {
					let currentGoods = null;
					for (let i in goodsCart) {
						if (goodsCart[i].id == goods.id) {
							currentGoods = goodsCart[i];
							break;
						}
					}
					if (currentGoods) {
						let selectStatus = false;
						console.log('目前选择的购物车数据', currentGoods.current_form.name);
						let namelist = currentGoods.current_form.name.split(",")
						let pidlist = []
						
						for (let i in goods.form_child) {
							for (let j in namelist) {
								if (goods.form_child[i].name == namelist[j]) {
									if(pidlist.indexOf(goods.form_child[i].pid)){
										console.log("有")
									}
									pidlist.push(goods.form_child[i].pid)
									goods.form_child[i].select = true;
									goods.number = currentGoods.number;
									break;
								} else {
									console.log("修改false",goods.form_child[i].name)
									goods.form_child[i].select = false;
								}
							}
						}
					}
				}
				that.currentGoodsData = goods;
				//加法计算，实时改变显示的金额
				//要操作的规则放入多规格数组
				let selectChildList = []; //多规格数组
				for (let i in that.currentGoodsData.form_child) {
					if (that.currentGoodsData.form_child[i].select == true) {
						selectChildList.push(JSON.parse(JSON.stringify(that.currentGoodsData.form_child[i])));
					}
				}
				//将所有信息统一到数组第一条
				let totalMoney = 0;
				console.log("selectChildList", selectChildList.length)
				for (let i = 0; i < selectChildList.length; i++) {
					totalMoney = totalMoney + Number(selectChildList[i].price);
				}
				console.log('该商品总价格：', selectChildList[0].price);
				selectChildList[0].price = totalMoney.toString();
				that.currentGoodsData.totalpricetemp =Number(selectChildList[0].price).toFixed(2);
				//打开选择面板
				that.$refs.popup.open();
			},
			//关闭隐藏规格
			hiddenForm() {
				this.$refs.popup.close();
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: #ffffff;
	}
	.hintMessage{
		display: flex;
		flex-direction: row;
		margin-top: 20rpx;
		.item{
			position: relative;
			font-size: 24rpx;
			color: rgba(89, 89, 89, 1);
			margin-right: 24rpx;
		}
		.item:not(:last-child)::after{
			content: '';
			position: absolute;
			right: -22rpx;
			top: 8rpx;
			width: 1rpx;
			height: 18rpx;
			margin: 0 10rpx;
			background-color: rgba(137, 137, 137, 1);
			
		}
	}
	.mark-tag {
		padding: 2rpx 8rpx;
		font-size: 24rpx;
		border-radius: 8rpx;
		white-space: nowrap;
		width: 110rpx;
		height: 35rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 18rpx;
		color: #ff5c26;
		border-radius: 5rpx;
		white-space: nowrap;
		margin-right: 20rpx;
	}
	
	.mark-tag-new {
		padding: 2rpx 8rpx;
		font-size: 24rpx;
		border-radius: 8rpx;
		white-space: nowrap;
		width: 150rpx;
		height: 35rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 18rpx;
		color: #ff5c26;
		border-radius: 5rpx;
		white-space: nowrap;
		margin-right: 20rpx;
	}

	//主题颜色
	$hx-theme-color: #ffc107;
	$hx-theme-color-light: #ffeb3b;

	.add {
		position: fixed;
		right: 60upx;
		top: 300upx;
		z-index: 999;
	}

	.ctn {
		/* border: 2rpx solid #e3e3e3; */
		width: 100%;
		display: flex;
		justify-content: flex-end;
		overflow: hidden;
		align-items: center;

		.searchCtn {
			display: flex;
			border-radius: 80upx;
			padding: 8upx 12upx;
			line-height: 44upx;
			background: #e0e0e0;
			overflow: hidden;
			align-items: center;
			min-width: 44rpx;
		}

		.leftBox {
			display: flex;
			width: 106rpx;
			justify-content: space-between;
			flex: none;
			margin: 0 16rpx;
		}

		.jrNull {
			/* #ifdef MP */
			width: 190rpx;
			flex: none;
			/* #endif */
		}
	}

	.hx-bb {
		border-bottom: 2rpx solid $uni-border-color;
	}

	.hx-txt-10 {
		font-size: 20rpx;
	}

	.hx-txt-12 {
		font-size: 24rpx;
	}

	.hx-txt-14 {
		font-size: 28rpx;
	}

	.hx-txt-16 {
		font-size: 32rpx;
	}

	.hx-txt-18 {
		font-size: 36rpx;
	}

	.hx-txt-22 {
		font-size: 44rpx;
	}

	.hx-color-gray {
		color: #bbbbbb;
	}

	.hx-color-white {
		color: #ffffff;
	}

	.hx-color-black {
		color: #333333;
	}

	.hx-txt-weigth {
		font-weight: bold;
	}

	.hx-mb-10 {
		margin-bottom: 20rpx;
	}

	.hx-mt-15 {
		margin-top: 30rpx;
	}

	.hx-shadow {
		box-shadow: 0rpx 6upx 16upx rgba(173, 173, 173, 0.2);
	}

	.miniBtn {
		position: relative;
		padding: 0 16rpx;
		border-radius: 16rpx;
		height: 40rpx;
		line-height: 40rpx;
		text-align: center;
		background:linear-gradient(98.99deg, rgba(252, 154, 141, 0.8) 5.06%, rgba(253, 219, 180, 0.8) 86.75%), #FFFFFF;;
		font-size: 20rpx;
		color: #000000;
		// font-weight: 700;

		.num {
			position: absolute;
			right: 0;
			top: -20rpx;
			width: 36rpx;
			height: 36rpx;
			line-height: 36rpx;
			font-size: 20rpx;
			color: #fff;
			background-color: #ff5722;
			text-align: center;
			border-radius: 50%;
		}
	}

	.hx-store {
		.header {
			position: relative;
			// min-height: 460rpx;
			&-bg {
				position: absolute;
				left: 0;
				top: 0;
				z-index: 2;
				width: 100%;
				height: 200rpx;
		     	// background: linear-gradient(45deg, #ffa473, #ffe681);
				background: url(/static/store/storeBg.png) no-repeat;
				background-size: cover;
			}
			&-bg-black {
				position: absolute;
				left: 0;
				top: 284rpx;
				bottom: 0;
				z-index: 1;
				background-color: #ffffff;
				width: 100%;
				transition: background-color 0.2s;
			}

			&-bg-gray {
				position: absolute;
				left: 0;
				top: 284rpx;
				bottom: -32rpx;
				z-index: 1;
				background-color: #afafaf;
				width: 100%;
				transition: background-color 0.2s;
			}

			&-top-Placeholder {
				height: 120rpx;
			}

			.storeInfo {
				position: relative;
				z-index: 2;
				background: #ffffff;
				height: 200rpx;
				border-radius: 28rpx 28rpx 0px 0px;
				padding: 24rpx;
				// margin-bottom: 8rpx;
				transition: all 0.2s;
				margin-top: 56rpx;
				.shrink-box {
					position: absolute;
					bottom: 0;
					left: 0;
					right: 0;
					text-align: center;
					font-size: 40rpx;
					color: #a2a8ab;
				}

				.storeAvatar {
					position: absolute;
					width: 120rpx;
					height: 120rpx;
					right: 50rpx;
					top: -10rpx;
					background: #ffffff;
					border-radius: 8rpx;
				}
			}
		}


		.tabs-box {
			width: 94%;
			position: sticky;
			top: calc(88rpx + var(--status-bar-height));
			z-index: 10;
			background-color: white;
			border-bottom:  0.8rpx solid #D9D9D9;
			height: 80rpx;
			margin-left: 3%;
			.hx-tabs {
				position: relative;
				display: flex;
				height: 100%;

				&-item {
					display: flex;
					flex-direction: row;
					justify-content: center;
					align-items: center;
					width: 140rpx;
					color: #666666;

					text {
						font-size: 28rpx;
					}
				}

				&-active {
					color: #333333;
					font-weight: bold;
				}

				&-slider-box {
					position: absolute;
					display: flex;
					justify-content: center;
					bottom: 0;
					width: 140rpx;
				}

				&-slider {
					display: flex;
					background: #FC9A8D
;
					width: 28rpx;
					height: 6rpx;
				}
			}
		}

		.main {
			// position: relative;
			background-color: #ffffff;
			#mainSwiper {
				background-color: #eeeeee;
				position: sticky;
				top: calc(80rpx + 88rpx + var(--status-bar-height));
				.scroll-items {

					// 商品列表样式
					.category-list {
						width: 100%;
						background-color: #fff;
						display: flex;
						padding-bottom: 100rpx;

						.left,
						.right {
							background: #fff;
							position: absolute;
							top: 0;
							bottom: 0upx;
						}

						.left {
							width: 24%;
							left: 0upx;
							background-color: #F8F8F8;
							.row::after{
								content: '';
								position: absolute;
								width: 80%;
								height: 1rpx;
								bottom: 0rpx;
								left: 10%;
								background-color: #D9D9D9;
							}
							.row {
								box-sizing: border-box;
								width: 100%;
								height: 90rpx;
								display: flex;
								align-items: center;
								overflow: hidden;
								position: relative;
								// border-bottom: 1rpx solid #D9D9D9;
								
								.text {
									width: 100%;
									font-size: 28rpx;
									color: #999999;
									overflow: hidden;
									text-overflow: ellipsis;
									display: -webkit-box;
									-webkit-box-orient: vertical;
									-webkit-line-clamp: 2;
									text-align: center;
									padding: 0 32rpx;
								}

								&-number {
									position: absolute;
									width: 36rpx;
									height: 36rpx;
									right: 8rpx;
									top: 8rpx;
									background: #ff5722;
									border-radius: 50%;
									line-height: 36rpx;
									text-align: center;
									font-size: 20rpx;
									color: #ffffff;
								}

								&.active {
									box-sizing: border-box;
									height: 90rpx;
									background-color: #fff;
									font-weight: 700;
									border-left: 6rpx solid #FC9A8D;
									border-bottom:0 ;
									
									.text {
										font-size: 28rpx;
										color: #000;
									}
								}
								&.active::after{
									content: '';
									height: 0;
								}
							}

							.row:last-child {
								margin-bottom: 200upx;
							}
						}

						.right {
							width: 76%;
							left: 24%;

							.goodsListBox {
								padding-bottom: 200rpx;

								.category {
									padding: 0 30rpx 20rpx 30rpx;

									.s-item {
										height: 90rpx;
										line-height: 90rpx;
										font-size: 24rpx;
										background: #ffffff;
										color: #000;
										position: sticky;
										top: 0;
										z-index: 18;
									}

									.list:last-child {
										margin-bottom: 0;
									}

									.list {
										margin-bottom: 40rpx;
										width: 100%;
										display: flex;
										flex-wrap: wrap;

										.box:first-child {
											.m-store-item {
												margin-top: 0;
											}
										}

										.box {
											width: 100%;

											.m-store-item {
												display: flex;
												flex-direction: row;
												width: 100%;
												justify-content: space-between;
												align-items: flex-end;
												margin-top: 30rpx;
												margin-bottom: 30rpx;

												.m-img {
													flex: 0 0 170rpx;
													height: 156rpx;
													background: #eee;
													image{
													border-radius: 8rpx;
														
													}
												}

												.m-text {
													flex: 1;
													position: relative;
													height: 156rpx;
													padding: 0 12rpx;
													display: flex;
													align-content: space-between;
													flex-direction: column;

													.m-title {
														font-size: 28rpx;
														color: #000;
														height: 42rpx;
														// font-weight: bold;
													}

													.m-descripe {
														font-size: 24rpx;
														color: #999999;
														margin-top: 10rpx;
														height: 70rpx;
													}

													.m-price-box {
														height: 48rpx;
														// font-weight: bold;
														display: flex;
														flex-direction: row;
														align-items: flex-end;
														
														.symbol {
															color: #FE371D;
															font-size: 18rpx;
														}

														.m-price {
															position: relative;
															top: 4rpx;
															font-size: 28rpx;
															color: #FE371D;
														}

														.m-old-price {
															margin-left: 6rpx;
															display: flex;
															flex-direction: row;
															font-size: 18rpx;
															color: #999999;
															margin-top: 5upx;
															text-decoration: line-through;
															font-weight: normal;
														}
													}

													.m-distance {
														position: absolute;
														right: 0;
														bottom: -8rpx;
														z-index: 16;
														color: #b2b2b2;
														font-size: 20upx;
														text-align: right;

														.jumpPosition {
															position: absolute;
															bottom: 46rpx;
															right: 0;
															z-index: 2;
															width: 56rpx;
															height: 56rpx;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}

				.evaluate-box {}

				.business-box {
					.info-list {
						background: #ffffff;
						padding: 0 30rpx;

						&-container {
							line-height: 92rpx;
							height: 92rpx;
							display: flex;
							flex-direction: row;

							[class*='hxicon-'] {
								color: #a2a2a2;
								margin-right: 16rpx;
							}

							text {
								font-size: 28rpx;
							}

							.right {
								float: right;
								color: #dddddd;
								display: flex;
								flex-direction: row;
								align-items: center;

								[class*='hxicon-'] {
									color: #dddddd;
									margin-right: 0;
									font-size: 32rpx;
								}
							}
						}
					}
				
				}
			}
		}

		.foot {
			position: fixed;
			display: flex;
			z-index: 999;

			justify-content: center;
			align-items: center;
			bottom: 0;
			height: 100%;
			width: 100%;

			.btn-box {
				position: absolute;
				display: flex;
				bottom: 30rpx;
				justify-content: center;
				align-items: center;
				margin: 0 3%;
				height: 100rpx;
				width: 94%;
				border-radius:16rpx ;
				z-index: 999;
				box-shadow: 0px 8rpx 12rpx rgba(0, 0, 0, 0.15);
				&-left {
					background: #222222;
					border-top-left-radius: 100rpx;
					border-top-right-radius: 18rpx;
					border-bottom-left-radius: 100rpx;
					border-bottom-right-radius: 18rpx;
					padding-left: 6upx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-self: center;
					width: 140rpx;
					height: 100%;
					color: #f6d200;
					text-align: center;

					.imgBox {
						display: flex;
						text-align: center;
						justify-content: center;

						image {
							width: 40rpx;
							height: 40rpx;
						}
					}

					text {
						font-size: 20upx;
					}
				}

				&-line {
					background: #ffffff;
					width: 4rpx;
					height: 100%;
				}

				&-center {
					height: 100%;
					flex: auto;
					display: flex;
					justify-content: flex-start;
					align-self: center;
					align-items: center;
					background: #404040;
					border-radius: 16rpx 0 0 16rpx;
					padding-left: 32rpx;

					.cart {
						position: relative;
						width: 104rpx;
						height: 104rpx;
						bottom: 12rpx;
						margin-right: 20rpx;
						image {
							width: 100%;
							height: 100%;
						}

						.tag {
							position: absolute;
							right: 0;
							top: 0;
							height: 36rpx;
							width: 36rpx;
							background-color: #ff4000;
							color: #ffffff;
							border-radius: 50%;
							z-index: 1;
							font-size: 20rpx;
							text-align: center;
							line-height: 36rpx;
						}
					}

					.priceBox {
						flex: auto;
						.hx-color-white{
							// font-size: 20rpx;
							font-weight: 900;
						}
					}
				}

				&-right {
					width:30%;
					height: 100%;
					position: relative;
					display: flex;
					justify-content: flex-start;
					align-self: center;
					align-items: center;
					border-radius: 0 16rpx 16rpx 0;
					overflow: hidden;
					
					.pscj {
						width: 100%;
						height: 100%;
						// background: #222222;
						text-align: center;
						display: flex;
						justify-content: center;
						align-self: center;
						align-items: center;
						background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), linear-gradient(111.77deg, #FC9A8D 56.92%, #FDDBB4 109.99%);
						color: rgba(255, 255, 255, 0.6);
						font-size: 28rpx;
					}

					.jiesuan {
						width: 100%;
						height: 100%;
						font-size: 28rpx;
						text-align: center;
						display: flex;
						justify-content: center;
						align-self: center;
						align-items: center;
						background: linear-gradient(111.77deg, #FC9A8D 56.92%, #FDDBB4 109.99%);
						font-weight: bold;
						color: #FFF;
					}
				}
			}

			.zz {
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				background-color: rgba(0, 0, 0, 0.7);
				z-index: 1;
			}

			.cart-box {
				display: flex;
				justify-content: flex-start;
				flex-flow: column;
				background: #ffffff;
				position: absolute;
				bottom: 0;
				z-index: 2;
				max-height: 66%;
				padding-bottom: 124rpx;
				border-top-left-radius: 32rpx;
				border-top-right-radius: 32rpx;
				overflow: hidden;
				width: 100%;

				.rebate-box {
					height: 60rpx;
					background: #ffc107;
					color: #ff9900;
					text-align: center;
					line-height: 60rpx;
					font-size: 28rpx;
				}

				.box-container {
					box-sizing: border-box;
					padding: 0 32rpx;
				}

				.operating-box {
					font-size: 24rpx;
					line-height: 80rpx;
					height: 80rpx;
					border-bottom: 2rpx solid #f6f6f6;
					color: #666666;
					display: flex;
					flex-direction: row;

					&_right {
						flex: 1;
					}

					&_left {
						display: flex;
						flex-direction: row;
					}
				}

				.goods-box {
					height: 100%;
					overflow: hidden;
					flex: 1;
					display: flex;

					.goods-list-scroll {
						height: 100%;

						.goods-list {
							width: 100%;
							display: flex;
							flex-wrap: wrap;

							.box {
								width: 100%;
								border-bottom: 2rpx solid #f6f6f6;
								box-sizing: border-box;
								padding: 0 32rpx;

								.m-store-item {
									display: flex;
									flex-direction: row;
									width: 100%;
									justify-content: space-between;
									align-items: flex-end;
									padding-top: 30rpx;
									padding-bottom: 30rpx;

									.m-img {
										flex: 0 0 170rpx;
										height: 170rpx;
										background: #eee;
										border-radius: 8rpx;
									}

									.m-text {
										flex: 1;
										position: relative;
										height: 170rpx;
										padding: 0 12rpx;
										display: flex;
										align-content: space-between;
										flex-direction: column;

										.m-title {
											font-size: 32rpx;
											color: #555555;
											height: 42rpx;
											font-weight: bold;
										}

										.m-descripe {
											font-size: 24rpx;
											color: #999999;
											margin-top: 10rpx;
											height: 70rpx;
										}

										.m-price-box {
											height: 48rpx;
											font-weight: bold;
											display: flex;
											flex-direction: row;
											align-items: flex-end;

											.symbol {
												color: #ff582b;
												font-size: 24rpx;
											}

											.m-price {
												position: relative;
												top: 4rpx;
												font-size: 36rpx;
												color: #ff582b;
											}

											.m-old-price {
												margin-left: 6rpx;
												display: flex;
												flex-direction: row;
												font-size: 20rpx;
												color: #999999;
												margin-top: 5upx;
												text-decoration: line-through;
												font-weight: normal;
											}
										}

										.m-distance {
											position: absolute;
											right: 0;
											bottom: -8rpx;
											z-index: 16;
											color: #b2b2b2;
											font-size: 20upx;
											text-align: right;

											.jumpPosition {
												position: absolute;
												bottom: 46rpx;
												right: 0;
												z-index: 2;
												width: 56rpx;
												height: 56rpx;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	
	}

	.form-main {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		justify-content: left;
		padding: 30rpx;
		width: 700rpx;
		height: 1000rpx;
		.form-main_ctn {
			display: flex;
			flex-direction: column;
			justify-content: left;
			padding: 46rpx 44rpx 44rpx 44rpx;
			background-color: #fff;
			border-radius: 16rpx;
			width: 700rpx;
			height: 800rpx;
			.godos_tit {
				margin-top: 8rpx;
				margin-bottom: 12rpx;
				font-size: 36rpx;
				font-weight: bold;
				color: #333;
			}

			.gg_tit {
				margin-top: 16rpx;
				font-size: 28rpx;
				font-weight: bold;
				color: #555;
			}

			.gg_box {
				margin-top: 16rpx;
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				font-size: 12;
				color: #333;

				.item {
					margin-right: 28rpx;
					margin-bottom: 28rpx;
					border: 2rpx solid #f1f1f1;
					border-radius: 8rpx;
					padding: 8rpx 12rpx;
				}

				.item.active {
					border-color: #ffe081;
					background-color: #fff0b7;
				}
			}

			.select_gg {
				margin: 20rpx -24rpx 0;
				padding: 12rpx 24rpx;
				color: #999;
				background-color: #f9f9f9;
				display: flex;
				flex-direction: row;

				.lable {}

				.select_gg_box {
					flex: 1;
					display: flex;
					flex-direction: row;
					flex-wrap: wrap;
					margin-bottom: 30rpx;
					.gg-item {
						color: #333;

						.gg-item-cut {
							margin-left: 6rpx;
							margin-right: 6rpx;
						}
					}

					.gg-item:last-child {
						.gg-item-cut {
							display: none;
						}
					}
				}
			}

			.bottom {
				position: relative;
				display: flex;
				flex-direction: row;
				margin-top: 20rpx;
				.price_box {
					flex: 1;
					lign-items: baseline;
					color: #ff582b;
					font-size: 28rpx;
					position: relative;
					top: 8rpx;

					.price {
						font-size: 48rpx;
					}
				}

				.jumpPosition {
					position: absolute;
					right: 32rpx;
					top: 4rpx;
				}

				.form-btn-box {
					height: 60rpx;
					line-height: 60rpx;
					
					.add-btn {
						border-radius: 100rpx;
						background: linear-gradient(98.99deg, rgba(252, 154, 141, 0.8) 5.06%, rgba(253, 219, 180, 0.8) 86.75%), #FFFFFF;
						padding: 0 24rpx;
						display: flex;
						height: 60rpx;
						line-height: 60rpx;
						align-items: center;

						i {
							font-weight: bold;
							font-size: 36rpx;
							margin-right: 6rpx;
							margin-left: -8rpx;
						}

						text {
							font-size: 28rpx;
							font-weight: bold;
							color: #363636;
						}
					}
				}
			}
		}

		.close {
			position: absolute;
			left: 50%;
			margin-left: -40rpx;
			bottom: 0rpx;
			border-radius: 50%;
			height: 80rpx;
			width: 80rpx;
			background-color: #fff;
			opacity: 0.7;
			text-align: center;
			line-height: 86rpx;

			i {
				font-weight: bold;
				font-size: 44rpx;
			}
		}
	}
</style>
